package com.future.message.configuration.Security;

import com.future.message.Utils.ResponseResult;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:访问越权
 * @projectName:message
 * @see:com.future.message.configuration.Security
 * @author:Xuyujie
 * @createTime:2021/12/6 14:40
 * @version:1.0
 */
public class SimpleAccessDeniedHandler implements AccessDeniedHandler {
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {

        ResponseResult.out(response,ResponseResult.error(403,"您无权进行访问！"));
    }
}
